<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>提现</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, maximum-scale=1, user-scalable=no,viewport-fit=cover">
    <link href="css/common.css" rel="stylesheet">
    <script src="https://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
    <style>

        #allWithdraw{
            margin-left: 10vw;
            font-size: 0.8em;
            color: #2196F3;
        }

    </style>
</head>
<body>
<div class="head-nav">
    <div class="nav-left" onclick="goCenter()"><img src="img/gua/u18.png"></div>
    <div class="nav-title">提现</div>
</div>
<div class="main">
    <div class="tab-info">
        <div>
            <div class="user-pic"><img id="userPic" src="img/gua/u19.png"></div>
            <div class="user-info">
                <div>您好！<span id="nickName">-</span></div>
                <div>
                    账户余额：<span class="red"><span id="money" data-value="">-</span><span>元</span></span>
                </div>
            </div>
        </div>
    </div>
    <div style="height: 12vw"></div>
    <div class="user-btn">
        <div class="wd-49">
            <div class="small-btn btn-normal" id="cashDraw">门店提现</div>
        </div>
        <div class="wd-49">
            <div class="small-btn btn-normal" id="WxDraw">平台提现</div>
        </div>
    </div>
    <div style="height: 8vw"></div>
    <div class="tips red">
        <div>友情提示：</div>
        <div>1.门店提现：扫描店铺提现二维码，店家确认后会把钱给您</div>
        <div>2.每单/天最大限额均为二万元。</div>
    </div>
</div>



<script src="js/jquery-1.8.0.min.js"></script>
<script src="js/common.js"></script>
<script src="js/jquery.cookie.js"></script>
<script src="https://cdn.bootcss.com/layer/3.0.1/layer.min.js"></script>

<script type="application/javascript">
    var phoneNum;
    $(function () {
        getopenid();
        opendIdLogin();


        var paramStr = {};
        paramStr.url = window.location.href;
        var params = {};
        params.paramStr = JSON.stringify(paramStr);

        Common.ajaxWithParam("/fenful/api/v1/common/getWxConfig",params, function(returnData) {
            console.log(returnData);
            appId = returnData.appId;
            timestamp = returnData.timestamp;
            nonceStr = returnData.nonceStr;
            signature = returnData.signature;

            console.log(appId);

            wx.config({ //开始微信的配置 将获取的数据拿去请求
                debug: false,
                appId: appId,
                timestamp: timestamp,
                nonceStr: nonceStr,
                signature: signature,
                jsApiList: [ //可以调用下面的接口 我们这里只是调用scanQRCode 也就是扫码接口

                    'scanQRCode'

                ]
            });

            wx.ready(function(res) {
                console.log("successs!");
            });

            wx.error(function(res) {

            });
        });

        /*
         * 注意：
         * 1. 所有的JS接口只能在公众号绑定的域名下调用，公众号开发者需要先登录微信公众平台进入“公众号设置”的“功能设置”里填写“JS接口安全域名”。
         * 2. 如果发现在 Android 不能分享自定义内容，请到官网下载最新的包覆盖安装，Android 自定义分享接口需升级至 6.0.2.58 版本及以上。
         * 3. 常见问题及完整 JS-SDK 文档地址：http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html
         *
         * 开发中遇到问题详见文档“附录5-常见错误及解决办法”解决，如仍未能解决可通过以下渠道反馈：
         * 邮箱地址：weixin-open@qq.com
         * 邮件主题：【微信JS-SDK反馈】具体问题
         * 邮件内容说明：用简明的语言描述问题所在，并交代清楚遇到该问题的场景，可附上截屏图片，微信团队会尽快处理你的反馈。
         */

    });

    $("#cashDraw").on("click",function () {
        wx.scanQRCode({
            needResult: 1,
            desc: 'scanQRCode desc',
            success: function(res) {
                var code=res.resultStr;
                window.location.href = code;
            }
        });
    });

    var openid;
    function getopenid() {
        openid = window.localStorage.getItem("openid");
        if(openid == null || openid == undefined || openid == '') {
            getCode();
        }
    }
    function getCode() {
        var code = Common.queryGetParam('code');
        if(code == null || code == undefined || code == '') {
            location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx95bdc635798fcfe4&redirect_uri="+window.location.href+"&response_type=code&scope=snsapi_base#wechat_redirect";
            return;
        }
        var paramStr = {};
        paramStr.code = code;
        var params = {};
        params.paramStr = JSON.stringify(paramStr);
        Common.ajaxWithParam("/fenful/api/v1/common/getWxUserOpenId", params, function(data) {
            openid = data.openid;
            window.localStorage.setItem("openid", data.openid);
        },false);
    }

    function opendIdLogin() {
        var paramStr = {};
        paramStr.wxOpenId = openid;
        var params = {};
        params.paramStr = JSON.stringify(paramStr);
        Common.ajaxWithParam("/fenful/api/v1/login/wxOpenIdLoginOrRegister", params, function(data) {
            $("#nickName").text(data.nickName);
            $("#money").text(data.money);
            $("#userPic").attr("src",data.headImg);

            if(data.phoneNum){
                phoneNum = data.phoneNum;
                window.localStorage.setItem("phoneNum", data.phoneNum);
            }

            console.log(data);
        },false);
    }

    function goCenter() {
        window.location.href = "myAccount.html";
    }
</script>
</body>
</html>